﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using MyBlog.DataAccess;
using MyBlog.Model;
using MyBlog.Common;
using AutoMapper;
using MyBlog.BusinessInterface;
using MyBlog.DataEntity;
using MyBlog.DataAccessInterface;
namespace MyBlog.Business
{
    public class BusinessSysLog : IBusinessSysLog
    {
        IDALSysLog _dalLog;
        IUnitOfWork _unitWork;
        public BusinessSysLog(IDALSysLog dalLog, IUnitOfWork unitWork)
        {
            _dalLog = dalLog;
            _unitWork = unitWork;
        }
        public void Add(SysLogModel entity)
        {
            var dataEntity = Mapper.Map<Tbl_SysLog>(entity);
            _dalLog.Add(dataEntity);
            _unitWork.Commit();
        }

        public List<SysLogModel> GetAll(bool isTracking = true)
        {
            var entities = _dalLog.GetAll(isTracking);
            return entities.MapToList<Tbl_SysLog, SysLogModel>();
        }

        public List<SysLogModel> GetAll(SysLogModel model, bool isTracking = true)
        {
            var where = LinqExpressionBuilder.True<Tbl_SysLog>();
            var entities = _dalLog.GetAll(where, isTracking);
            return entities.MapToList<Tbl_SysLog, SysLogModel>();
        }


        public void AddRange(IEnumerable<SysLogModel> entities)
        {
            throw new NotImplementedException();
        }

        public void Update(SysLogModel entity)
        {
            throw new NotImplementedException();
        }

        public void Delete(params object[] primaryKey)
        {
            throw new NotImplementedException();
        }

        public void Delete(SysLogModel entity)
        {
            throw new NotImplementedException();
        }

        public void DeleteRange(IEnumerable<SysLogModel> entities)
        {
            throw new NotImplementedException();
        }

        public SysLogModel Get(params object[] primaryKey)
        {
            throw new NotImplementedException();
        }

        public SysLogModel Get(SysLogModel entity)
        {
            throw new NotImplementedException();
        }

        public List<SysLogModel> GetAll(SysLogModel model, int page, int size, out int total, bool isTracking = true)
        {
            throw new NotImplementedException();
        }
    }
}
